package com.scalar.forecast.forecastEntry.forms;

import com.scalar.forecast.forecastEntry.TableMetaData;
import com.scalar.forecast.forecastEntry.RowData;
import com.scalar.forecast.ForecastActionForm;

import java.util.ArrayList;
import java.util.LinkedList;

import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * User: Sujan Kumar
 * Date: Feb 14, 2005
 * Time: 12:33:59 PM
 */
public class ForecastEntryForm extends ForecastActionForm
{
    private ArrayList searchFieldList;
    private int custId;
    private int projectId;
    private int productId;
    private int odmId;
    private int startMonth_Quarter_Year;
    private int year;
    private int showNext;
    private boolean build = false;

    private TableMetaData tableMetaData;
    private LinkedList tableDataList;

    private LinkedList actualTableDataList;
    private boolean showActualValues;
    private boolean showAllSalesPersonsActualValues;

    private RowData buildRowData;

	/**
	 * This property is used to store the default values in jsp page when the check box is deselected.<br>
	 * added by sujan on 02 june 2005.
	 */
	private LinkedList tableDataListDefaultValues;

    public ForecastEntryForm()
    {
        searchFieldList = new ArrayList();
        custId = -1;
        projectId = -1;
        productId = -1;
        odmId = -1;
        startMonth_Quarter_Year = -1;
        year = -1;
        showNext = 0;

        tableMetaData = new TableMetaData();
        tableDataList = new LinkedList();

        actualTableDataList = new LinkedList();
        showActualValues = false;
        showAllSalesPersonsActualValues = false;

        buildRowData = new RowData();
    }

    public int getCustId()
    {
        return custId;
    }

    public void setCustId(int custId)
    {
        this.custId = custId;
    }

    public int getOdmId()
    {
        return odmId;
    }

    public void setOdmId(int odmId)
    {
        this.odmId = odmId;
    }

    public int getProductId()
    {
        return productId;
    }

    public void setProductId(int productId)
    {
        this.productId = productId;
    }

    public int getProjectId()
    {
        return projectId;
    }

    public void setProjectId(int projectId)
    {
        this.projectId = projectId;
    }

    public ArrayList getSearchFieldList()
    {
        return searchFieldList;
    }

    public void setSearchFieldList(ArrayList searchFieldList)
    {
        this.searchFieldList = searchFieldList;
    }

    public int getShowNext()
    {
        return showNext;
    }

    public void setShowNext(int showNext)
    {
        this.showNext = showNext;
    }

    public int getStartMonth_Quarter_Year()
    {
        return startMonth_Quarter_Year;
    }

    public void setStartMonth_Quarter_Year(int startMonth_Quarter_Year)
    {
        this.startMonth_Quarter_Year = startMonth_Quarter_Year;
    }

    public LinkedList getTableDataList()
    {
        return tableDataList;
    }

    public void setTableDataList(LinkedList tableDataList)
    {
        this.tableDataList = tableDataList;
    }

    public TableMetaData getTableMetaData()
    {
        return tableMetaData;
    }

    public void setTableMetaData(TableMetaData tableMetaData)
    {
        this.tableMetaData = tableMetaData;
    }

    public int getYear()
    {
        return year;
    }

    public void setYear(int year)
    {
        this.year = year;
    }

    public boolean isBuild()
    {
        return build;
    }

    public void setBuild(boolean build)
    {
        this.build = build;
    }

    public LinkedList getActualTableDataList()
    {
        return actualTableDataList;
    }

    public void setActualTableDataList( LinkedList actualTableDataList )
    {
        this.actualTableDataList = actualTableDataList;
    }

    public boolean isShowActualValues()
    {
        return showActualValues;
    }

    public void setShowActualValues( boolean showActualValues )
    {
        this.showActualValues = showActualValues;
    }

    public boolean isShowAllSalesPersonsActualValues()
    {
        return showAllSalesPersonsActualValues;
    }

    public void setShowAllSalesPersonsActualValues( boolean showAllSalesPersonsActualValues )
    {
        this.showAllSalesPersonsActualValues = showAllSalesPersonsActualValues;
    }

    public RowData getBuildRowData()
    {
        return buildRowData;
    }

    public void setBuildRowData( RowData buildRowData )
    {
        this.buildRowData = buildRowData;
    }

    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest)
    {
        showActualValues = false;
        showAllSalesPersonsActualValues = false;

        if ( tableDataList == null )
        {
            tableDataList = new LinkedList();
        }
        int tableDataListSize = tableDataList.size();
        RowData rowData = null;
        for ( int row=0; row < tableDataListSize; row++ )
        {
            rowData = ( RowData )tableDataList.get ( row );
            rowData.setSelected( false );
        }

        if ( buildRowData == null )
        {
            buildRowData = new RowData();
        }
    }

	public LinkedList getTableDataListDefaultValues ()
	{
		return tableDataListDefaultValues;
	}

	public void setTableDataListDefaultValues ( LinkedList tableDataListDefaultValues )
	{
		this.tableDataListDefaultValues = tableDataListDefaultValues;
	}
}
